Optimal. Leaf size=123 \[ -\frac {\sqrt {2} (c-d)^2 \tanh ^{-1}\left (\frac {\sqrt {a} \cos (e+f x)}{\sqrt {2} \sqrt {a+a \sin (e+f x)}}\right )}{\sqrt {a} f}-\frac {4 (3 c-d) d \cos (e+f x)}{3 f \sqrt {a+a \sin (e+f x)}}-\frac {2 d^2 \cos (e+f x) \sqrt {a+a \sin (e+f x)}}{3 a f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.13, antiderivative size = 123, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 27, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.148, Rules used = {2840, 2830,
2728, 212} \begin {gather*} -\frac {4 d (3 c-d) \cos (e+f x)}{3 f \sqrt {a \sin (e+f x)+a}}-\frac {\sqrt {2} (c-d)^2 \tanh ^{-1}\left (\frac {\sqrt {a} \cos (e+f x)}{\sqrt {2} \sqrt {a \sin (e+f x)+a}}\right )}{\sqrt {a} f}-\frac {2 d^2 \cos (e+f x) \sqrt {a \sin (e+f x)+a}}{3 a f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 212
Rule 2728
Rule 2830
Rule 2840
Rubi steps
\begin {align*} \int \frac {(c+d \sin (e+f x))^2}{\sqrt {a+a \sin (e+f x)}} \, dx &=-\frac {2 d^2 \cos (e+f x) \sqrt {a+a \sin (e+f x)}}{3 a f}+\frac {2 \int \frac {\frac {1}{2} a \left (3 c^2+d^2\right )+a (3 c-d) d \sin (e+f x)}{\sqrt {a+a \sin (e+f x)}} \, dx}{3 a}\\ &=-\frac {4 (3 c-d) d \cos (e+f x)}{3 f \sqrt {a+a \sin (e+f x)}}-\frac {2 d^2 \cos (e+f x) \sqrt {a+a \sin (e+f x)}}{3 a f}+(c-d)^2 \int \frac {1}{\sqrt {a+a \sin (e+f x)}} \, dx\\ &=-\frac {4 (3 c-d) d \cos (e+f x)}{3 f \sqrt {a+a \sin (e+f x)}}-\frac {2 d^2 \cos (e+f x) \sqrt {a+a \sin (e+f x)}}{3 a f}-\frac {\left (2 (c-d)^2\right ) \text {Subst}\left (\int \frac {1}{2 a-x^2} \, dx,x,\frac {a \cos (e+f x)}{\sqrt {a+a \sin (e+f x)}}\right )}{f}\\ &=-\frac {\sqrt {2} (c-d)^2 \tanh ^{-1}\left (\frac {\sqrt {a} \cos (e+f x)}{\sqrt {2} \sqrt {a+a \sin (e+f x)}}\right )}{\sqrt {a} f}-\frac {4 (3 c-d) d \cos (e+f x)}{3 f \sqrt {a+a \sin (e+f x)}}-\frac {2 d^2 \cos (e+f x) \sqrt {a+a \sin (e+f x)}}{3 a f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.27, size = 125, normalized size = 1.02 \begin {gather*} -\frac {2 \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right ) \left ((-3-3 i) (-1)^{3/4} (c-d)^2 \tanh ^{-1}\left (\left (\frac {1}{2}+\frac {i}{2}\right ) (-1)^{3/4} \left (-1+\tan \left (\frac {1}{4} (e+f x)\right )\right )\right )+d \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right ) (6 c-d+d \sin (e+f x))\right )}{3 f \sqrt {a (1+\sin (e+f x))}} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 3.48, size = 185, normalized size = 1.50
method | result | size |
default | \(\frac {\left (1+\sin \left (f x +e \right )\right ) \sqrt {-a \left (\sin \left (f x +e \right )-1\right )}\, \left (-3 a^{\frac {3}{2}} \sqrt {2}\, \arctanh \left (\frac {\sqrt {a -a \sin \left (f x +e \right )}\, \sqrt {2}}{2 \sqrt {a}}\right ) c^{2}+6 a^{\frac {3}{2}} \sqrt {2}\, \arctanh \left (\frac {\sqrt {a -a \sin \left (f x +e \right )}\, \sqrt {2}}{2 \sqrt {a}}\right ) c d -3 a^{\frac {3}{2}} \sqrt {2}\, \arctanh \left (\frac {\sqrt {a -a \sin \left (f x +e \right )}\, \sqrt {2}}{2 \sqrt {a}}\right ) d^{2}+2 \left (a -a \sin \left (f x +e \right )\right )^{\frac {3}{2}} d^{2}-12 a c d \sqrt {a -a \sin \left (f x +e \right )}\right )}{3 a^{2} \cos \left (f x +e \right ) \sqrt {a +a \sin \left (f x +e \right )}\, f}\) | \(185\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 306 vs.
\(2 (112) = 224\).
time = 0.35, size = 306, normalized size = 2.49 \begin {gather*} \frac {\frac {3 \, \sqrt {2} {\left (a c^{2} - 2 \, a c d + a d^{2} + {\left (a c^{2} - 2 \, a c d + a d^{2}\right )} \cos \left (f x + e\right ) + {\left (a c^{2} - 2 \, a c d + a d^{2}\right )} \sin \left (f x + e\right )\right )} \log \left (-\frac {\cos \left (f x + e\right )^{2} - {\left (\cos \left (f x + e\right ) - 2\right )} \sin \left (f x + e\right ) - \frac {2 \, \sqrt {2} \sqrt {a \sin \left (f x + e\right ) + a} {\left (\cos \left (f x + e\right ) - \sin \left (f x + e\right ) + 1\right )}}{\sqrt {a}} + 3 \, \cos \left (f x + e\right ) + 2}{\cos \left (f x + e\right )^{2} - {\left (\cos \left (f x + e\right ) + 2\right )} \sin \left (f x + e\right ) - \cos \left (f x + e\right ) - 2}\right )}{\sqrt {a}} - 4 \, {\left (d^{2} \cos \left (f x + e\right )^{2} + 6 \, c d - 2 \, d^{2} + {\left (6 \, c d - d^{2}\right )} \cos \left (f x + e\right ) + {\left (d^{2} \cos \left (f x + e\right ) - 6 \, c d + 2 \, d^{2}\right )} \sin \left (f x + e\right )\right )} \sqrt {a \sin \left (f x + e\right ) + a}}{6 \, {\left (a f \cos \left (f x + e\right ) + a f \sin \left (f x + e\right ) + a f\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\left (c + d \sin {\left (e + f x \right )}\right )^{2}}{\sqrt {a \left (\sin {\left (e + f x \right )} + 1\right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.58, size = 199, normalized size = 1.62 \begin {gather*} \frac {\frac {3 \, \sqrt {2} {\left (\sqrt {a} c^{2} - 2 \, \sqrt {a} c d + \sqrt {a} d^{2}\right )} \log \left (\sin \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}{a \mathrm {sgn}\left (\cos \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )} - \frac {3 \, \sqrt {2} {\left (\sqrt {a} c^{2} - 2 \, \sqrt {a} c d + \sqrt {a} d^{2}\right )} \log \left (-\sin \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}{a \mathrm {sgn}\left (\cos \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )} - \frac {8 \, \sqrt {2} {\left (a^{\frac {5}{2}} d^{2} \sin \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 3 \, a^{\frac {5}{2}} c d \sin \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )}}{a^{3} \mathrm {sgn}\left (\cos \left (-\frac {1}{4} \, \pi + \frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )}}{6 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \frac {{\left (c+d\,\sin \left (e+f\,x\right )\right )}^2}{\sqrt {a+a\,\sin \left (e+f\,x\right )}} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________